package com.ceba.test.modules.filemanage.entity;

import java.io.File;

import com.ceba.base.utils.IDSFileUtils;
import com.ceba.base.web.entity.IBase;
import com.ceba.test.base.utils.CebaFileManageUtil;

public class GFile extends IBase{

	/**
	 * 
	 */
	private static final long serialVersionUID = 671233711549460415L;

	private String id;
	
	private String contentType;
	
	private String filePath;
	
	private String fileName;
	
	//拓展名
	private String extName;
	
	private String virtualPath;
	
	public String classS;
	
	private long size;
	
	private String textContent;
	
	private int documentType;
	
	private String scope;
	
	private String remark;
	
	private String version;
	
	private String dataVersion;
	
	private String qrCodeFileId;
	
	private String createTime;
	
	private String createUser;
	
	private String updateTime;
	
	private String updateUser;

	//文件存储地址ID
	private String storageAddressId;

	//文件内容ID
	private String textContetnId;



	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getExtName() {
		return extName;
	}

	public void setExtName(String extName) {
		this.extName = extName;
	}

	public String getVirtualPath() {
		return virtualPath;
	}

	public void setVirtualPath(String virtualPath) {
		this.virtualPath = virtualPath;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public String getTextContent() {
		return textContent;
	}

	public void setTextContent(String textContent) {
		this.textContent = textContent;
	}

	public int getDocumentType() {
		return documentType;
	}

	public void setDocumentType(int documentType) {
		this.documentType = documentType;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getQrCodeFileId() {
		return qrCodeFileId;
	}

	public void setQrCodeFileId(String qrCodeFileId) {
		this.qrCodeFileId = qrCodeFileId;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public String getCreateUser() {
		return createUser;
	}

	public String getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public String getClassS() {
		return classS;
	}

	public void setClassS(String classS) {
		this.classS = classS;
	}

	public String getDataVersion() {
		return dataVersion;
	}

	public void setDataVersion(String dataVersion) {
		this.dataVersion = dataVersion;
	}

	public String getStorageAddressId() {
		return storageAddressId;
	}

	public void setStorageAddressId(String storageAddressId) {
		this.storageAddressId = storageAddressId;
	}

	public String getTextContetnId() {
		return textContetnId;
	}

	public void setTextContetnId(String textContetnId) {
		this.textContetnId = textContetnId;
	}

	public static GFile createGFile(String id, String fileName, String contentType, String text,
									String signFilePath, String classS, String loginUserId, String storageAddressId, String virtualPath) throws Exception{
		File file = new File(signFilePath);
		GFile gf =new GFile();
		gf.setId(id);
		gf.setFileName(CebaFileManageUtil.filterFileName(fileName));
		gf.setContentType("");
		gf.setTextContent(text);
		gf.setExtName(IDSFileUtils.getFileExtName(fileName));
		gf.setVirtualPath(virtualPath);
		if(file.exists()){
			gf.setSize(file.length());
		}
		gf.setFilePath(signFilePath);
		gf.setClassS(classS);
		//获取当前使用的存储Id
		gf.setStorageAddressId(storageAddressId);
		gf.setCreateUser(loginUserId);
		return gf;
		
	}
}
